package com.amita.ez;

import com.baomidou.mybatisplus.extension.api.R;
import org.mybatis.spring.annotation.MapperScan;
import org.springframework.boot.SpringApplication;
import org.springframework.boot.autoconfigure.SpringBootApplication;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RestController;

@SpringBootApplication
@MapperScan("com.amita.ez.mapper")
@RestController
public class EzApplication {

    public static void main(String[] args) {
        SpringApplication.run(EzApplication.class, args);
    }

    @GetMapping("/whoami")
    public Object whoami(){
        return R.ok("ez  后台 api ");
    }


//    @Bean
//    public WebMvcConfigurer corsConfigurer() {
//
//        return new WebMvcConfigurer() {
//            public void addCorsMappings(CorsRegistry registry) {
//                registry.addMapping("/**")
//                        //.allowedOrigins(ip)  //可访问ip，ip最好从配置文件中获取，
//                        .allowedMethods("*")
//                        .allowedHeaders("*")
//                        .exposedHeaders("access-control-allow-headers", "access-control-allow-methods", "access-control-allow-origin", "access-control-max-age", "X-Frame-Options")
//                        .allowCredentials(true).maxAge(3600);
//            }
//        };
//
//    }

}
